# -*- coding:utf-8 -*-

"""
会员标产品推荐

"""
from aw import *
from autotest import *


class Test_005(TestCase):


    def setUp(self):
        print("Test_001 setUp")
        Common.selectProduct("PD201811021853258996436--会员稳盈45天")
        Common.selectTemplate()
        Common.getProducts()
        Common.getProducts(product_type=2)
        Common.getProducts(product_type=15)

        Common.selectProductRate("ZC201810271616327806101")


        for pno in ['ZC201811191115310212344','ZC201811191116155200801']+['PD201811161640251229152','PD201811191114163598009']:
            Common.updateProduct(pno, product_status=5, raise_end_time="2018-11-30 19:44:59", )  # 恢复这个
            Common.updateProduct(pno, product_status=6, raise_end_time="2018-11-18 19:44:59", )




        for pno in ['ZC201811151350058083557', 'ZC201811151415367927560', 'ZC201811151415534120233']+['PD201811151349183508456','PD201811151349401041970','PD201811151414454444682','PD201811151415187240374']:
            Common.updateProduct(pno, product_status=5, raise_end_time="2018-11-30 19:44:59", )  # 恢复这个
            Common.updateProduct(pno, product_status=6, raise_end_time="2018-11-18 19:44:59", )

        #创建计划类产品
        Common.createProduct(product_Type="黄金月增2", tmpId=178, raise_end_time="2018-11-29 23:59:59",productType=15)
        Common.createProduct(product_Type="黄金周增", tmpId=176, raise_end_time="2018-11-29 23:59:59",productType=15)
        Common.createProduct(product_Type="黄金双月增", tmpId=177, raise_end_time="2018-11-29 23:59:59",productType=15)
        Common.createProduct(product_Type="黄金季增", tmpId=175, raise_end_time="2018-11-29 23:59:59",productType=15)


        #创建定期产品
        Common.createProduct(prodType="dq",tmpId=26,product_term=30, raise_end_time="2018-11-29 23:59:59",productType=15)
        Common.createProduct(prodType="dq",tmpId=26,product_term=45, raise_end_time="2018-11-29 23:59:59",productType=15)
        Common.createProduct(prodType="dq",tmpId=476,product_term=180, raise_end_time="2018-11-29 23:59:59",productType=15)
        Common.createProduct(prodType="dq",tmpId=476,product_term=180, raise_end_time="2018-11-29 23:59:59",productType=15)
        Common.createProduct(prodType="dq",tmpId=477,product_term=365, raise_end_time="2018-11-29 23:59:59",productType=15)


        Common.dumpProduct("ZC201810231934317207970")
        Common.loadProduct("ZC201810231704586551135")

        Common.cleanCache("ZC201810271612155392959")
        Common.cleanCache("1100111023")
        Common.cleanCache("1100099819")
        Common.getProducts()
        Common.getProducts(product_type=2)
        Common.getProducts(product_type=15)

        Common.updateProduct("ZC201810271612155392959--月增1",product_name="月增1810271-1")
        Common.updateProduct("ZC201811021604048264702--稳盈30天",product_name="黄金会员月增1811021")
        Common.updateProduct("PD201811021853119517155--稳盈30天",product_name="稳赢180天1-1811021 ",product_term=180)
        Common.updateProduct("PD201811021853398797070--会员稳盈45天",product_term=365)


    def test(self):
        Common.getRecordProduct(product_type=2)
        Common.getRecordProduct(product_type=15)


        zou_zeng = ["ZC201811021833328156795--周增"]
        # for pno in zou_zeng:
        #     Common.updateProduct(pno, product_status=6, raise_end_time="2018-10-22 19:44:59", )
        #     Common.updateProduct(pno, raise_start_time="2018-11-06 20:45:58")
        Common.updateProduct("PD201811021853398797070", product_status=5, raise_start_time="2018-11-17 19:44:59", raise_end_time="2018-11-30 19:44:59",)


        yue_zeng = ["ZC201811141901070099536--月增1","ZC201811021832090309643--月增2",]

        for pno in yue_zeng:
            Common.updateProduct(pno, product_status=5, raise_end_time="2018-11-30 19:44:59", ) # 恢复这个
            Common.updateProduct(pno, product_status=6, raise_end_time="2018-10-22 19:44:59", )
            Common.updateProduct(pno, raise_start_time="2018-11-06 20:45:58")
            Common.raiseInterest("ZC201810271612369903395--月增2", interest=0.01)
            Common.raiseInterest("ZC201811021832090309643--月增1",interest=0.01)

        shuang_yue_zeng = ["ZC201811021834341578717--双月增"]

        # for pno in shuang_yue_zeng:
        #     Common.updateProduct(pno, product_status=6, raise_end_time="2018-10-22 19:44:59", )
        #     Common.updateProduct(pno, raise_start_time="2018-11-06 20:45:58")
        #     Common.updateProduct(pno, raise_start_time="2018-10-28 20:45:58")


        ji_zeng = ["ZC201811021835047727276--季增"]
        # for pno in ji_zeng:
        #     Common.updateProduct("PD201811021853398797070", product_status=6, raise_end_time="2018-10-22 19:44:59", )
        #     Common.updateProduct(pno, raise_start_time="2018-11-06 20:45:58")


        # 稳赢 依次是30天 45天 180天 365天
        wen_yin = ["PD201811021836319447203--稳盈30天",
                   "PD201811021852365833709--稳盈45天",
                   "PD201811021853119517155--稳盈180天1"
                   "PD201811021853258996436--稳盈180天2",
                   "PD201811021853398797070---稳盈365天"]

        for pno in zou_zeng+yue_zeng+shuang_yue_zeng+ji_zeng+wen_yin:
            Common.updateProduct(pno, product_status=5,raise_end_time="2018-11-22 19:44:59", )
            Common.dumpProduct(pno)
            Common.dumpProduct("PD201811021537011796814--稳盈180天2")

        #       Common.loadProduct(pno)
            Common.updateProduct(pno,product_status=5,raise_start_time="2018-10-26 20:45:58",raise_end_time="2018-11-22 19:44:59",)

        Common.updateProduct("PD201811021853398797070", raise_start_time="2018-11-28 20:45:58")
        Common.raiseInterest("PD201811021853119517155")
        Common.updateProduct("PD201811021853258996436--会员稳盈45天", product_status=6, raise_end_time="2018-10-22 19:44:59", )
        Common.updateProduct("PD201811021853258996436--会员稳盈45天", product_status=5, raise_end_time="2018-11-22 19:44:59", )

        for pno in [
        'ZC201809271631462113800', 'ZC201811021604048264702', 'ZC201811021614205379893', 'ZC201811021616137665272',
         'ZC201811021619190878061', 'ZC201811021832090309643', 'ZC201811021833328156795', 'ZC201811021834341578717',
         'ZC201811021835047727276'] + [
        'PD201809271654469893110', 'PD201809271655214585887', 'PD201811021617014015765', 'PD201811021836319447203',
         'PD201811021852365833709', 'PD201811021853119517155', 'PD201811021853258996436', 'PD201811021853398797070']:
            Common.updateProduct(pno, product_status=5, raise_end_time="2018-11-30 19:44:59", )

            for pno in ['ZC201811021616137665272','ZC201811021619190878061','ZC201811021614205379893','PD201811021617014015765']:
                Common.updateProduct(pno, product_status=5, raise_end_time="2018-11-22 19:44:59", )




    def tearDown(self):
        print("Test_001 tearDown")
